import { _decorator, Component, instantiate, Node, NodePool, Pool, Prefab, ScrollView } from 'cc';
import { UIBase } from '../../FrameWork3.8.6/FrameWork/UIFramework/UIBase';
import { PropertyDt } from '../../FrameWork3.8.6/FrameWork/Common/CommonInterface';
import { ResMgr } from '../../FrameWork3.8.6/FrameWork/Res/ResMgr';
import { BundleConfig } from '../../FrameWork3.8.6/FrameWork/NeedToChange/BundleConfig';
import { Emitter } from '../../FrameWork3.8.6/FrameWork/Common/Emitter';
import { ShiBingPanel } from './ShiBingPanel';
import { EquipmentDtMgr, PlayerSkillDtMgr, ShiBingDtMgr } from '../../FrameWork3.8.6/FrameWork/Data/DataBaseMgr';
import { BagManager } from '../Game/Manager/BagManager';
const { ccclass, property } = _decorator;

@ccclass('PlayerPropertyBase')
//这是装备UI，技能UI，兵种UI所继承的基类
export class PlayerPropertyBase extends UIBase {
    //按钮生成对象池
    protected _gridBtnNodePool:Pool<Node>=null;
    onInit(...rest: any[]): void {
        //获取网格节点的预制体
        let GridPrefab = ResMgr.instance.getRes<Prefab>(BundleConfig.Game.name,'GridButtonPrefab');
        this._gridBtnNodePool = new Pool<Node>(()=>{
            let node =instantiate(GridPrefab);
            return node;
        },5,(node:Node)=>{
            node.destroy();
        });

        //关闭按钮注册事件
        this.addClickEventListener("_CloseBtn",()=>{
            //后续可能会传参数，因为修改了玩家属性
            this.closeUI(this.uiName,true);
        })
        //调用初始化方法
        this.initData.apply(this,arguments);
       
    }
    //供派生类重写的初始化方法
    initData(){
        
    }
    //当前点击按钮打开的界面信息
    openDetailsPanel(propertyDt:PropertyDt,num:number){
        this.openUI("DetailsPanel",false,false,BundleConfig.UI.name,"Normal",propertyDt,num);
    }

    //当前装备按钮打开的界面信息
    openEquipDetailsPanel(propertyDt:PropertyDt){
        this.openUI("EquipDetailsPanel",false,false,BundleConfig.UI.name,"Normal",propertyDt);
    }
}


